import request from '@/utils/request'
import type { AttrInfoModel, AttrListModel } from './model/attrModel'
import type { CategoryIdsModel} from './model/categoryStoreModel'

enum Api {
  // 获取属性列表数据
  getAttrListApi = '/admin/product/attrInfoList',
  // 删除属性
  deleteAttrInfoApi = '/admin/product/deleteAttr',
  // 添加或更新品牌属性
  saveOrUpdateAttrInfoApi = '/admin/product/saveAttrInfo'
}
// 获取分类列表数据
export const reqGetAttrListData = ({ category1Id, category2Id, category3Id }:CategoryIdsModel)=> {
  return request.get<any,AttrListModel>(Api.getAttrListApi + `/${category1Id}/${category2Id}/${category3Id}`)
}
// 删除品牌属性
export const reqDeleteAttrInfo = (attrId: number) =>{
  return request.delete<any,null>(Api.deleteAttrInfoApi+`/${attrId}`)
}
// 添加/更新品牌属性
export const reqSaveOrUpdateAttrInfo = (attrInfo: AttrInfoModel)=>{
  return request.post<any,null>(Api.saveOrUpdateAttrInfoApi,attrInfo)
}